<template>
  <div class="posttable">
    <el-row>
      <el-col style="padding-right: 30px;padding-left: 60px;">
        <div class="addform addForm">
          <el-form :label-position="labelPosition" ref="form" :model="form" :rules="rules">
            <el-row class="change">
              <el-col :span="6">
                <el-form-item label="推送客户" prop="customerName" style="margin-bottom: 10px;">
                  <el-select
                    v-model.trim="form.customerName"
                    placeholder="请选择推送客户"
                    @change="selectcustomer"
                  >
                    <el-option
                      v-for="item in customerNames"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="需求编号" prop="requireNum" style="margin-bottom: 10px;">
                  <el-select
                    v-model.trim="form.requireNum"
                    placeholder="请选择需求编号"
                    @change="selposition"
                  >
                    <el-option v-for="item in num" :key="item" :label="item" :value="item"></el-option>
                  </el-select>
                  <div class="el-form-item__error" v-if="requireNumout">该需求已关闭，请重新选择需求编号!</div>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="!gjsshow">
                <el-form-item label="推送职位" prop="postName" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.postName" placeholder="请输入推送职位" disabled></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="gjsshow">
                <el-form-item label="需求名称" prop="postName" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.postName" placeholder="请选择需求名称" disabled></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="职位级别" prop="postLevel" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.postLevel" placeholder="请输入职位级别" disabled></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="所属区域" prop="area" style="margin-bottom: 10px;">
                  <el-select v-model.trim="form.area" placeholder="请选择所属区域">
                    <el-option v-for="item in Areas" :key="item" :label="item" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="性别" prop="sex" style="margin-bottom: 10px;">
                  <el-select v-model.trim="form.sex" placeholder="请选择性别">
                    <el-option label="男" value="男"></el-option>
                    <el-option label="女" value="女"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="姓名" prop="name" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.name" placeholder="请输入姓名"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="出生年月" prop="birthday" style="margin-bottom: 10px;">
                  <el-date-picker
                    v-model.trim="form.birthday"
                    format="yyyy-MM"
                    value-format="yyyy-MM"
                    type="month"
                    style="width: 274px;"
                    placeholder="选择日期"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="学历" prop="education" style="margin-bottom: 10px;">
                  <el-select v-model.trim="form.education" education placeholder="请选择学历">
                    <el-option
                      v-for="item in education"
                      :key="item.value"
                      :label="item.value"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="毕业院校" prop="college" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.college" placeholder="请输入毕业院校"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="专业" prop="speciality" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.speciality" placeholder="请输入专业"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="毕业时间" prop="graduationTime" style="margin-bottom: 10px;">
                  <el-date-picker
                    v-model.trim="form.graduationTime"
                    format="yyyy-MM"
                    type="month"
                    style="width: 274px;"
                    value-format="yyyy-MM"
                    placeholder="请输入毕业时间"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="联系方式" prop="phone" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.phone" placeholder="请输入联系方式"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="联系邮箱" prop="mail" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.mail" placeholder="请输入联系邮箱"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="离职状态" prop="status" style="margin-bottom: 10px;">
                  <el-select v-model.trim="form.status" placeholder="请选择离职状态">
                    <el-option
                      v-for="item in status"
                      :key="item.value"
                      :label="item.value"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="简历来源" prop="origin" style="margin-bottom: 10px;">
                  <el-select v-model.trim="form.origin" placeholder="请选择简历来源">
                    <el-option
                      v-for="item in originlist"
                      :key="item.value"
                      :label="item.value"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="当前薪资(单位(K))" prop="currentSalary" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.currentSalary" placeholder="请输入当前薪资"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="!gjsshow">
                <el-form-item label="期望薪资(单位(K))" prop="expectSalary" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.expectSalary" placeholder="请输入期望薪资" @blur="isSuitSalary"></el-input>
                  <div v-if="Salaryflag" class="el-form-item__error">
                    期望薪资超过薪资上限
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="gjsshow">
                <el-form-item label="rate cate" prop="ratecode" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.ratecode" placeholder="请输入rate cate"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="!gjsshow">
                <el-form-item label="期望薪数" prop="expectSalaryNum" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.expectSalaryNum" placeholder="请输入期望薪数"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="最低薪资(单位(K))" prop="miniSalary" style="margin-bottom: 10px;">
                  <el-input v-model.trim="form.miniSalary" placeholder="请输入最低薪资"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-show="gjsshow">
                <el-form-item
                  label="语言能力"
                  prop="remark"
                  style="margin-bottom: 10px;"
                  class="remark"
                >
                  <el-input v-model.trim="form.remark" placeholder="请输入语言能力" style="width: 100%;"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="未推送原因" prop="initialEvaluation" style="margin-bottom: 10px;">
                  <el-input
                    style="width: 100%;"
                    type="textarea"
                    v-model.trim="form.initialEvaluation"
                    placeholder="请输入未推送原因"
                    :autosize="{ minRows: 4}"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col>
                <el-col>
                  <el-form-item style="margin-bottom: 10px;">
                    <div style="max-width:32rem;margin-top: 10px;">
                      <el-upload
                        class="upload-demo"
                        ref="upload"
                        type="file"
                        :action="actionurl"
                        :before-upload="beforeupload"
                        :show-file-list="true"
                        :file-list="fileList"
                        :on-success="handleAvatarSuccess"
                        :on-remove="handleRemove"
                        :limit="2"
                        accept=".pdf, .docx, .doc"
                      >
                        <el-button class="upload" slot="trigger">选取中文文件</el-button>
                      </el-upload>
                    </div>
                  </el-form-item>
                  <el-col style="margin-bottom: 30px;">
                    <div
                      v-if="!filetype"
                      style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
                    >文件上传格式为pdf、docx、doc。
                    </div>
                    <div
                      v-if="selectfile"
                      style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
                    >请上传文件!
                    </div>
                  </el-col>
                </el-col>
                <el-col v-if="gjsshow">
                  <el-form-item style="margin-bottom: 10px;">
                    <div style="max-width:32rem;margin-top: 10px;">
                      <el-upload
                        class="upload-demo"
                        ref="upload1"
                        type="file"
                        :action="actionurl"
                        :before-upload="beforeupload1"
                        :show-file-list="true"
                        :file-list="fileList1"
                        :on-success="handleAvatarSuccess1"
                        :on-remove="handleRemove1"
                        :limit="2"
                        accept=".pdf, .docx, .doc"
                      >
                        <el-button class="upload" slot="trigger">选取英文文件</el-button>
                      </el-upload>
                    </div>
                  </el-form-item>
                  <el-col style="margin-bottom: 30px;">
                    <div
                      v-if="!filetype1"
                      style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
                    >文件上传格式为pdf、docx、doc。
                    </div>
                  </el-col>
                </el-col>
              </el-col>
              <el-col>
                <el-form-item>
                  <el-button class="save" :disabled="senddis" @click="submitForm('form')">上传</el-button>
                  <el-button class="cancel" @click="cancel('form')">取消</el-button>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </el-col>
    </el-row>
    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible"
      width="30%"
      :before-close="errorinfoClose"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">{{errorinfo}}!</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="errorinfoClose">确 定</el-button>
        <el-button round @click="errorinfoClose" class="cancel">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  import axios from "axios";
  import qs from "qs";
  
  export default {
    name: "addresume",
    
    data() {
      var checkexpectSalary = (rule, value, callback) => {
        var re = /^(\d{1,2})+(\.\d{1,2})?-\d{1,2}$/;
        this.Salaryflag = false;
        setTimeout(() => {
          if (value) {
            if (!re.test(value)) {
              callback(new Error("期望薪资的格式为xx-xx且不得超过99"));
            } else {
              //字符串类型的数字类型进行比较时，如果是多位数的数字只会对第一位的数字进行比较，所以需要转换成number类型再进行比较
              var data = Number(value.split("-")[0]);
              var data1 = Number(value.split("-")[1]);
              if (data > data1) {
                callback(new Error("后面的数字必须大于前面的数字"));
              } else {
                callback();
              }
            }
          } else {
            callback();
          }
        }, 100);
      };
      return {
        labelPosition: "top",
        form: {
          customerName: "",
          postName: "",
          postLevel: "",
          requireNum: "",
          sex: "男",
          name: "",
          education: "",
          college: "",
          speciality: "",
          graduationTime: "",
          birthday: "",
          area: "",
          phone: "",
          mail: "",
          status: "",
          entryTime: "",
          currentSalary: "",
          expectSalary: "",
          expectSalaryNum: "",
          ratecode: "",
          miniSalary: "",
          interviewTime: "",
          remark: "",
          initialEvaluation: "",
          originalFilename: '',
          fileAddress: '',
          fileNameEn: '',
          fileAddrEn: '',
          group: '',
          suffix: ''
        },
        requireNumout: false,
        customerNames: [],
        num: [],
        education: [
          {
            value: "大专"
          },
          {
            value: "本科"
          },
          {
            value: "硕士"
          },
          {
            value: "博士"
          }
        ],
        Areas: [],
        status: [
          {
            value: "在职"
          },
          {
            value: "离职"
          }
        ],
        originlist: [
          {
            value: "智联"
          },
          {
            value: "前程无忧"
          },
          {
            value: "猎聘"
          },
          {
            value: "boss"
          },
          {
            value: "中华英才"
          },
          {
            value: "其他"
          }
        ],
        customerId: "",
        rules: {
          customerName: [
            {required: true, message: "请选择推送客户", trigger: "change"}
          ],
          postName: [
            {required: true, message: "请输入推送职位", trigger: "blur"}
          ],
          postLevel: [
            {required: true, message: "请输入职位级别", trigger: "blur"}
          ],
          requireNum: [
            {required: true, message: "请选择需求编号", trigger: "change"}
          ],
          sex: [{required: true, message: "请选择性别", trigger: "change"}],
          name: [{required: true, message: "请输入姓名", trigger: "blur"}],
          birthday: [
            {required: false, message: "请输入出生年月", trigger: "blur"}
          ],
          education: [
            {required: false, message: "请选择学历", trigger: "change"}
          ],
          college: [
            {required: false, message: "请输入毕业院校", trigger: "blur"}
          ],
          speciality: [
            {required: false, message: "请输入专业", trigger: "blur"}
          ],
          graduationTime: [
            {required: false, message: "请输入毕业时间", trigger: "blur"}
          ],
          area: [{required: true, message: "请选择所属区域", trigger: "blur"}],
          phone: [
            {required: true, message: "请输入联系方式", trigger: "blur"},
            {
              pattern: /(^0\d{2,4}\-\d{7,8}$)|(^1[3|4|5|6|7|8|9][0-9]{9}$)/,
              message: "请输入正确的联系方式",
              trigger: "blur"
            }
          ],
          mail: [
            {required: false, message: "请输入邮箱", trigger: "blur"},
            {
              pattern: /^[A-Za-z\d]+(([-_.]*)+[A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/,
              message: "请输入正确的邮箱",
              trigger: "blur"
            }
          ],
          status: [
            {required: false, message: "请选择离职状态", trigger: "change"}
          ],
          entryTime: [
            {required: true, message: "请输入到岗时间", trigger: "blur"}
          ],
          currentSalary: [
            {
              pattern: /^\d{1,2}$/,
              message: "当前薪资为0-99的数字",
              trigger: "blur"
            }
          ],
          expectSalary: [
            {required: false, message: "请输入期望薪资", trigger: "blur"},
            {validator: checkexpectSalary, trigger: "blur"}
          ],
          ratecode: [
            {required: true, message: "请输入rate cate", trigger: "blur"}
          ],
          expectSalaryNum: [
            {required: false, message: "请输入期望薪数", trigger: "blur"},
            {
              pattern: /^\d{1,2}$/,
              message: "期望薪数为0-99的数字",
              trigger: "blur"
            }
          ],
          miniSalary: [
            {
              pattern: /^\d{1,2}$/,
              message: "最低薪资为0-99的数字",
              trigger: "blur"
            }
          ],
          origin: [
            {required: true, message: "请选择简历来源", trigger: "change"}
          ],
          initialEvaluation: [
            {required: true, message: "请输入未推送原因", trigger: "blur"}
          ]
        },
        file: {},
        fileList: [],
        selectfile: false,
        filetype: true,
        file1: {},
        fileList1: [],
        filetype1: true,
        gjsshow: false,
        Salaryflag: false,
        name: "",
        savedis: false,
        senddis: false,
        errordialogVisible: false,
        errorinfo: null,
        actionurl: null,
      };
    },
    created() {
      this.actionurl = this.url + "/statistics/entryInfo/upload";
      axios.post(this.url + "/resumeUpload/getCustomerNames").then(res => {
        this.unlogin(res.data.code);
        if (res.data.code == 200) {
          this.customerNames = res.data.data;
        }
      });
      axios.get(this.url + "/demand/getAreas").then(res => {
        this.unlogin(res.data.code);
        if (res.data.code == 200) {
          this.Areas = res.data.data;
        }
      });
    },
    methods: {
      //获取需求编号的下拉框数据
      selectcustomer() {
        this.form.postName = "";
        this.form.requireNum = "";
        this.form.postLevel = "";
        this.form.fileAddrEn = '';
        this.form.fileAddress = '';
        this.file1 = {};
        this.fileList1 = [];
        this.filetype1 = true;
        axios
          .post(
            this.url + "/resumeUpload/getNoByCustomerName",
            qs.stringify({
              customerName: this.form.customerName
            })
          )
          .then(res => {
            this.unlogin(res.data.code);
            if (res.data.code == 200) {
              this.num = res.data.data;
            }
          });
        this.form.ratecode = "";
        if (this.form.customerName == "港交所") {
          this.gjsshow = true;
          this.form.expectSalary = "";
          this.form.expectSalaryNum = "";
          this.form.remark = "";
          this.Salaryflag = false;
        } else {
          this.gjsshow = false;
        }
      },
      //获取职位名称和职位级别
      selposition() {
        this.form.postLevel = "";
        this.form.postName = "";
        this.requireNumout = false;
        if (this.form.customerName == "港交所") {
          this.Salaryflag = false;
          axios
            .post(
              this.url + "/resumeUpload/getDemandNameByCustomerId",
              qs.stringify({
                no: this.form.requireNum
              })
            )
            .then(res => {
              this.unlogin(res.data.code);
              if (res.data.code == 200) {
                this.form.postName = res.data.data;
              }
            });
        } else {
          this.isSuitSalary();
          axios
            .post(
              this.url + "/resumeUpload/getPostNameByCustomerId",
              qs.stringify({
                no: this.form.requireNum
              })
            )
            .then(res => {
              this.unlogin(res.data.code);
              if (res.data.code == 200) {
                this.form.postName = res.data.data;
              }
            });
        }
        
        axios
          .post(
            this.url + "/resumeUpload/getPostLevelByNameAndCustomerId",
            qs.stringify({
              no: this.form.requireNum
            })
          )
          .then(res => {
            this.unlogin(res.data.code);
            if (res.data.code == 200) {
              this.form.postLevel = res.data.data;
            }
          });
      },
      sendclick1() {
        axios.post(this.url + "/resumeUpload/addResumes", this.form).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            if (res.data.message == "success") {
              this.senddis = false;
              document.documentElement.style.overflow = "auto";
              this.clearData();
              this.$emit("getData");
            }
            
            if (res.data.message == "存在该简历信息") {
              this.senddis = false;
              this.errorinfo = res.data.message;
              document.documentElement.style.overflow = "hidden";
              this.errordialogVisible = true;
            }
            
            if (res.data.message == "该需求已关闭") {
              this.senddis = false;
              this.requireNumout = true;
            }
            
            if (res.data.message == "该简历不达标不可推送") {
              this.senddis = false;
              this.errorinfo = res.data.message;
              document.documentElement.style.overflow = "hidden";
              this.errordialogVisible = true;
            }
            if (res.data.message == "今日该岗位简历已满") {
            this.senddis = false;
              this.errorinfo = res.data.message;
              document.documentElement.style.overflow = "hidden";
              this.errordialogVisible = true;
          }
          if (res.data.message == "该任意岗位，被组内成员做了") {
            this.senddis = false;
              this.errorinfo = res.data.message;
              document.documentElement.style.overflow = "hidden";
              this.errordialogVisible = true;
          }
          }
        });
      },
      clearData() {
        this.file = {};
        this.fileList = [];
        this.file1 = {};
        this.fileList1 = [];
        this.requireNumout = false;
        this.errorinfo = null;
        this.selectfile = false;
        this.filetype = true;
        this.filetype1 = true;
        this.gjsshow = false;
      },
      handleAvatarSuccess(res, file) {
        this.form.originalFilename = res.data.fileName;
        this.form.fileAddress = res.data.fileAddress;
        this.form.group = res.data.group;
        this.form.suffix = res.data.suffix;
      },
      handleAvatarSuccess1(res, file) {
        this.form.fileNameEn = res.data.fileName;
        this.form.fileAddrEn = res.data.fileAddress;
      },
      isSuitSalary() {
        var re = /^(\d{1,2})+(\.\d{1,2})?-\d{1,2}$/;
        if (this.form.expectSalary && this.form.requireNum) {
          if (re.test(this.form.expectSalary)) {
            //字符串类型的数字类型进行比较时，如果是多位数的数字只会对第一位的数字进行比较，所以需要转换成number类型再进行比较
            var data = Number(this.form.expectSalary.split('-')[0]);
            var data1 = Number(this.form.expectSalary.split('-')[1]);
            if (data <= data1) {
              axios.post(this.url + '/resumeUpload/isSuitSalary', {
                no: this.form.requireNum,
                expectSalary: this.form.expectSalary
              }).then(res => {
                this.unlogin(res.data.code);
                if (res.data.code == 200) {
                  if (res.data.data == false) {
                    this.Salaryflag = true
                  } else {
                    this.Salaryflag = false
                  }
                }
              })
            }
          }
        }
        if (this.form.expectSalary == '') {
          this.Salaryflag = false;
        }
      },
      submitForm(formName) {
        if (this.file.name == undefined) {
          this.selectfile = true;
        } else {
          this.selectfile = false;
        }
        this.isSuitSalary();
        this.$refs[formName].validate(valid => {
          if (valid && !this.selectfile && this.filetype  && this.filetype1 && !this.Salaryflag) {
            this.senddis = true;
            this.form.resumeStatus = "BC";
            this.sendclick1();
          }
        });
      },
      beforeupload(file) {
        this.file = {};
        this.file = file;
        this.selectfile = false;
        var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1);
        this.filetype = ((testmsg == 'docx') || (testmsg == 'pdf') || (testmsg == 'doc'));
        
        if (this.filetype) {
            this.file = file;
            this.fileList = [];
            this.fileList.push(this.file);
        }
        
        return (this.filetype)
      },
      beforeupload1(file) {
        this.file1 = {};
        this.file1 = file;
        var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1);
        this.filetype1 = ((testmsg == 'docx') || (testmsg == 'pdf') || (testmsg == 'doc'));
        if (this.filetype1) {
            this.file1 = file;
            this.fileList1 = [];
            this.fileList1.push(this.file1);
        }
        return (this.filetype1)
      },
      handleRemove1(file, fileList) {
        this.fileList1 = [];
        this.file1 = {};
        this.form.fileNameEn = "";
        this.form.fileAddrEn = "";
      },
      handleRemove(file, fileList) {
        this.file = {};
        this.fileList = [];
        this.form.originalFilename = '';
        this.form.fileAddress = '';
      },
      errorinfoClose() {
        this.errorinfo = null;
        document.documentElement.style.overflow = "auto";
        this.errordialogVisible = false;
      },
      initdata() {
        this.senddis = false;
        this.savedis = false;
        this.form = {
          customerName: "",
          postName: "",
          postLevel: "",
          requireNum: "",
          sex: "男",
          name: "",
          education: "",
          college: "",
          speciality: "",
          graduationTime: "",
          birthday: "",
          area: "",
          phone: "",
          mail: "",
          status: "",
          entryTime: "",
          currentSalary: "",
          expectSalary: "",
          expectSalaryNum: "",
          ratecode: "",
          miniSalary: "",
          interviewTime: "",
          remark: "",
          initialEvaluation: "",
          originalFilename: '',
          fileAddress: '',
          fileNameEn: '',
          fileAddrEn: '',
          group: '',
          suffix: ''
        };
        this.num = [];
        this.file1 = {};
        this.fileList1 = [];
        this.file = {};
        this.fileList = [];
      },
      cancel(formName) {
        this.savedis = false;
        this.senddis = false;
        this.clearData();
        this.$refs[formName].resetFields();
        this.$emit("getData");
      },
      resetFields(formName) {
        this.$refs[formName].resetFields();
      }
    }
  };
</script>
<style scoped>
  .addform {
    color: #333 !important;
  }
  
  .storage {
    width: 150px;
    height: 40px;
    font-size: 16px;
    color: #4e72f3;
    border-radius: 4px;
    margin-right: 43px;
    border-color: #4e72f3;
  }
  
  .save {
    width: 150px;
    height: 40px;
    font-size: 16px;
    color: #fff;
    border-radius: 4px;
    margin-right: 43px;
    background: linear-gradient(to bottom, #5696f8 0%, #4e6ef5 100%);
  }
  
  .cancel {
    width: 150px;
    height: 40px;
    border: 1px solid #4e6ef5;
    font-size: 16px;
    font-weight: 500;
    color: #4e6ef5;
  }
  
  .upload {
    width: 194px;
    height: 44px;
    margin-top: 10px;
    /*margin-bottom: 30px;*/
  }
</style>
